// 导入连接数据库配置文件
const { connectionStr } = require('../config')
// 连接MongoDB
const mongoose = require('mongoose')
// 解决一个警告
mongoose.set('useFindAndModify', false);
module.exports = () => {
  mongoose.connect(connectionStr,{useUnifiedTopology: true,useNewUrlParser:true})
  mongoose.connection.once("open", () => {
    console.log('数据库连接成功了');
  })
}